<?php
class models_banner extends connect{
	
	function _listbanner()
	{
		$sql = 'SELECT MaBanner,Hinh,AnHien FROM banner';
		$this-> query_db($sql);
		return $this->fetchAll();
	}
	function listbanner()
	{
		$sql = 'SELECT MaBanner,Hinh,AnHien FROM banner
				WHERE AnHien=1';
		$this-> query_db($sql);
		return $this->fetchAll();
	}
	
	function _addbanner($Hinh,$AnHien)
	{
		$sql = "INSERT INTO banner VALUES ('', '$Hinh','$AnHien')";
		$this->query_db($sql);
	}
	function _delbanner($id){
		$sql = "
				DELETE 
				FROM banner
				WHERE MaBanner = '$id'";
		$this->query_db($sql);
	}
	function _getbanner($id){
		$sql = "
				SELECT MaBanner,Hinh,AnHien
				FROM banner
				WHERE MaBanner = '$id'";
		$this->query_db($sql);
		return $this->fetchOne();
	}
	function _updatebanner($Hinh,$AnHien,$id){
		$sql = "UPDATE banner
				SET 
				    Hinh = '$Hinh', 
					AnHien = '$AnHien'
					WHERE MaBanner = '$id'";
		$this->query_db($sql);
	}
}
?>